package com.example.recycler

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.example.recycler.bean.StarryBean
import com.example.recycler.view.StarryListView
import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.toast

/**
 * Created by 舍长
 * describe:
 */
class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        /**
         * 已经解锁的章节的透明度是100%，未解锁章节的透明度是30%
         */
        val list = ArrayList<StarryBean>()
        list.add(StarryBean("烟火", true))
        list.add(StarryBean("守望", true))
        list.add(StarryBean("烟火", true))
        list.add(StarryBean("守望", true))
        list.add(StarryBean("烟火", false))
        list.add(StarryBean("守望", false))
        list.add(StarryBean("守望", false))
        list.add(StarryBean("守望", false))
        starryList.setListData(list)
        //设置点击回调监听
        starryList.setStarryOnClickListener(object :StarryListView.OnClickListener{
            override fun onSelect(index: Int) {
                toast("点击了${list[index].chapterName}")
            }
        })
    }
}
